<!--
 * @Author: HeAo
 * @Date: 2022-07-22 14:23:38
 * @LastEditTime: 2022-08-26 16:14:17
 * @LastEditors: HeAo
 * @Description: 
 * @FilePath: \HTML5&CSS3\第六天\8-父子集外边距合并.html
 * 别乱动！
-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>父子集-外边距合并</title>
  <style>
    .parent {
      width: 300px;
      height: 300px;
      background-color: lightblue;
      margin: 50px;
      /* 1、父元素设置padding */
      /* padding: 20px; */
      /* 2、父级设置边框 */
      /* border: 1px solid rebeccapurple; */
      /* 3、给父元素设置overflow */
      overflow: hidden;
    }

    .child {
      width: 100px;
      height: 100px;
      background-color: lemonchiffon;
      margin-top: 20px;

    }
  </style>
</head>

<body>
  <div class="parent">
    <div class="child"></div>
  </div>

</body>

</html>